home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000147_icon-group-sender _Sat Jun 29 10:41:11 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
1KB
Received: by cheltenham.cs.arizona.edu; Mon, 1 Jul 1996 08:32:45 MST
Date: Sat, 29 Jun 1996 10:41:11 +0200
From: karczma@calvin.info.unicaen.fr (Jerzy Karczmarczuk)
Message-Id: <9606290841.AA03532@canardo.unicaen.fr>
To: icon-group@cs.arizona.edu
Subject: Re: Ordered tables
X-Sun-Charset: US-ASCII
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
> From: Hamish Lawson <H.Lawson@tees.ac.uk>
>
> I'd like to be able to obtain the keys of a table in the order of their
> creation (key() produces them in random order). Is there a way to do
> this? Failing that, what is the best way to go about implementing a data
> structure in Icon that is both indexed and ordered?
>
> | Hamish Lawson, School of Computing and Mathematics,
Clinton Jeffery answered already. Hashed tables are popular for their
efficiency, and overloading them with extra ordering info seems - in
general - rather inefficient. So, Clint proposes a mirror list which keeps
track of the creation time ordering.
There is another possibility - store with each key not the bare item, but the
pair [item, ord_index], eventually pair with the item a link to the predecessor/
successor (or both) key(s). The memory overhead seems worse than in the proposal
of CJ, but you can do it selectively.
Jerzy Karczmarczuk
Comp. Sci., University of Caen, France.